<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{:lang('v_admin_system')}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="noindex,nofollow">
    <link rel="stylesheet" href="{:config('template.skin')}/fontawesome/css/all.min.css">
    <link rel="stylesheet" href="{:config('template.skin')}/css/adminlte.min.css">
    <link rel="stylesheet" href="{:config('template.skin')}/css/googlefonts.css?family=Source+Sans+Pro:300,400,400i,700">
    <link rel="stylesheet" href="{:config('template.skin')}/css/global.css">
</head>
<body class="hold-transition login-page" style="background:url({:config('template.skin')}/img/{$season}.jpg) center repeat;">
<div class="login-box">
    <!-- 标题 -->
    <div class="login-logo"><span class="h4 text-white">{:lang('v_admin_system')}</span></div>
    <div class="card" style="background: url({:config('template.skin')}/img/bg-white-lock.png);">
        <div class="card-body">
            <div class="px-3 pt-4 pb-3">
                <form name="form_login" id="form_login" method="post" action="/api/user/login.html">
                    <input type="hidden" name="entrance" value="admin">
                    <!-- 用户名密码 -->
                    <span class="text-danger clearfix" id="error"></span>
                    <div class="input-group mb-3">
                        <div class="input-group-prepend"><span class="input-group-text"><i class="fas fa-user"></i></span></div>
                        <input name="account" type="text" maxlength="50" class="form-control" placeholder="{:lang('v_username')} / {:lang('v_email')} / {:lang('v_mobile')}" autocomplete="off" />
                    </div>
                    <div class="input-group mb-3">
                        <div class="input-group-prepend"><span class="input-group-text"><i class="fas fa-lock"></i></span></div>
                        <input name="password" type="password" maxlength="20" class="form-control" placeholder="{:lang('v_password')}" autocomplete="off" />
                    </div>
                    <!-- 验证码 -->
                    <div class="row" id="show_verify" style="display: {$showhide};">
                        <div class="col-6 px-2 mb-3">
                            <div class="input-group">
                                <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-info-circle"></i></span></div>
                                <input name="verify" id="verify" type="text" maxlength="4" class="form-control" placeholder="{:lang('v_verify')}" />
                            </div>
                            <span class="text-danger" id="verify_error"></span>
                        </div>
                        <div class="col-6 px-2 mb-3">
                            <img id="img_verify" src="/captcha/" onclick="this.src='/captcha/?randid='+Math.floor(Math.random()*100);" border="0" width="100%" height="35" align="absmiddle" />
                        </div>
                    </div>
                    <!-- 保存一月 -->
                    <div class="d-none"><label class="font-weight-normal h7"><input type="checkbox" id="remember" name="remember" value="0" checked="checked" class="mr-1">{:lang('v_save_cookie')}</label></div>
                    <div class="social-auth-links text-center mb-3">
                        {if is_file(app()->getRootPath().'.env')}
                            <button type="submit" class="btn btn-success mr-4"><i class="fa fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                        {else /}
                            <button type="button" class="submit_login btn btn-block btn-info"><i class="fa fa-check-circle mr-2"></i>{:lang('v_login')}</button>
                        {/if}
                    </div>
                    <!-- 语言 -->
                    <p class="mb-3 h7 text-white">
                      {volist name="langlist" id="lang"}
                          <label class="mr-2 font-weight-normal">
                              <input name="lang" type="radio" value="{$lang.mulu}" {eq name="lang.isdefault" value="1"} checked="checked"{/eq} /><img src="{$lang.ico}" border="0" width="16" height="11" class="mx-1 mb-1" />{$lang.admintitle}
                          </label>
                      {/volist}
                    </p>
                </form>
                <p class="h7 mb-0 text-white border-top pt-3">{$helloChosen}</p>
            </div>
        </div>
    </div>
    <div class="text-center text-white h7">{:lang('v_version')}：{:config('global.version.name')}_{:config('global.version.code')}</div>
</div>
<script src="{:config('template.skin')}/jquery/jquery.min.js"></script>
<script src="{:config('template.skin')}/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="{:config('template.skin')}/js/adminlte.min.js"></script>
<script type="text/javascript">
/*按回车提交表单*/
$(document).keyup(function(event){
    if(event.keyCode == 13){
        $("#submit").trigger("click");
    }
});
/*登录 开始*/
$('.submit_login').click(function () {
    var lang = $("input[name='lang']:checked").val();
    //提交表单
    $.ajax({
        type: 'POST',
        url: '/api/user/login.html',
        dataType: 'json',
        data: $('#form_login').serialize(),
        success: function(data){
            switch(data.code){
                // 登录成功
                case 200:
                    window.location.href = '{:url('/index/index')}?lang='+lang;
                    break;
                //验证码错误，启用验证码
                case 1003:
                    $("#error").html(data.msg);
                    $('#img_verify').attr('src','/captcha/?randid='+Math.floor(Math.random()*100));
                    $('#verify').focus();
                    break;
                // 登录失败
                default:
                    $("#error").html(data.msg);
                    $('#account').focus();
                    break;
            }
            return false;
        }
    });
});
/*登录 结束*/
</script>
</body>
</html>